﻿@model WebShop.Models.CartModel
           
<div class="row-fluid">
    <div class="row">
        <div class="span2">
            &nbsp;</div>
        <div class="span8">
            <h3>@Model.Translate("cart")</h3>
            <table class="table table-striped cart">
                <thead>
                    <tr>
                        <th>@Model.Translate("product_index")</th>
                        <th>@Model.Translate("product_name")</th>
                        <th>@Model.Translate("price")</th>
                        <th>@Model.Translate("count")</th>
                        <th></th>
                    </tr>
                </thead>
                <tbody>
                    @{
                        int index = 1;
                    }
                    @foreach (var item in Model.Order.Composition)
                    {
                        <tr>
                            <td>@index
                            </td>
                            <td class="product_name">
                                <a href="@Url.RouteUrl("Product", new RouteValueDictionary { { "id", item.Product.Id } })">@item.Product.Name</a>
                            </td>
                            <td class="product_price">@item.Cost</td>
                            <td class="product_count">@item.Count</td>
                            <td class="product_control">
                                <a href="@Url.RouteUrl("Default", new RouteValueDictionary { { "controller", "cart" }, { "action", "add" }, { "id", item.Product.Id } })" class="btn btn-success">@Model.Translate("add_item_cart")</a>
                                <a href="@Url.RouteUrl("Default", new RouteValueDictionary { { "controller", "cart" }, { "action", "drop" }, { "id", item.Product.Id } })" class="btn btn-danger">@Model.Translate("drop_item_cart")</a>
                            </td>
                        </tr>
                        index++;
                    }
                        <tr>
                            <td></td>
                            <td class="product_name"><b>@Model.Translate("totaly"): </b></td>
                            <td class="product_price" colspan="2">@Model.TotalPrice</td>
                            <td></td>
                        </tr>
                </tbody>
            </table>

            <div class="cart-control">
                @if (Request.IsAuthenticated)
                {
                    <form class="well form-inline" method="post" action="@Url.Action("accept", "cart")">

                            <label for="select01" class="control-label">@Model.Translate("place")</label>

                            <select id="place" name="place">
                            @foreach (var item in Model.Places)
                            {
                                <option value="@item.Id">@item.Name, @item.Address </option>
                            }
                                
                            </select>

                        <button type="submit" class="btn btn-success"><i class="icon-shopping-cart icon-white"></i> @Model.Translate("accept_cart")</button>

                    </form>
                    <!-- <a href="@Url.RouteUrl("Default", new RouteValueDictionary { { "controller", "cart" }, { "action", "accept" } })" class="btn btn-success"><i class="icon-shopping-cart icon-white"></i> @Model.Translate("accept_cart")</a> -->
                }
                else
                {
                    <a href="@Url.RouteUrl("Default", new RouteValueDictionary { { "controller", "login" }, { "action", "index" } })" class="btn btn-primary"><i class="icon-user icon-white"></i> @Model.Translate("you_need_login")</a>
                }
            </div>
        </div>

        <div class="span2">&nbsp;</div> 
    </div>
</div>
